<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Task Details - TrackRay</title>

        <#include "header.html"/>

        <script>

            function getVulResult(id) {
                $.get(
                    "/task/getVuln",
                    {"id":id},
                    function (data) {
                        $("#vulResult").val(data);
                    }
                )
            }

        </script>
    </head>
    <body>

        <!-- Begin page -->
        <div class="wrapper">

            <#include "menu.html"/>


            <!-- ============================================================== -->
            <!-- Start Page Content here -->
            <!-- ============================================================== -->

            <div class="content-page">
                <div class="content">

                    <!-- Topbar Start -->
                    <#include "topbar.html"/>

                    <!-- end Topbar -->
                    
                    <!-- Start Content-->
                    <div class="container-fluid">

                        <!-- start page title -->
                        <div class="row">
                            <div class="col-12">
                                <div class="page-title-box">
                                    
                                    <h4 class="page-title">Task</h4>
                                </div>
                            </div>
                        </div>
                        <!-- end page title -->

                        <div class="row">
                            <div class="col-12">
                                <div class="card">
                                    <div class="card-body">
                                        <div class="table-responsive">
                                            <table class="table mt-4">
                                                <thead>
                                                <tr><th>#</th>
                                                    <th>#</th>



                                                </tr></thead>
                                                <tbody>
                                                <tr>
                                                    <td>任务名</td>
                                                    <td>
                                                        ${task.taskName}
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <td>目标</td>
                                                    <td>
                                                        ${task.target}
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <td>基本信息</td>
                                                    <td>
                                                        <textarea class="form-control" name="proxy" rows="15" >${task.baseInfo}</textarea>

                                                    </td>
                                                </tr>

                                                </tbody>
                                            </table>
                                        </div>

                                        <div class="table-responsive">

                                            <table class="table table-centered mb-0">
                                                <thead class="thead-light">
                                                <tr>

                                                    <th>标题</th>
                                                    <th>地址</th>
                                                    <th>等级</th>
                                                    <th>类型</th>
                                                    <th>载荷</th>
                                                    <th style="width: 125px;">操作</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <#list vulns as vul>

                                                    <tr>

                                                        <td>
                                                            <a href="#" class="text-body font-weight-bold">
                                                                <#if (vul.title)??>
                                                                    ${vul.title}
                                                                </#if></a>
                                                        </td>
                                                        <td>
                                                            <#if (vul.address)??>
                                                                <input type="text" class="form-control" value="${vul.address}">
                                                            </#if>
                                                        </td>
                                                        <td>
                                                            <#if (vul.level)??>
                                                            <#if vul.level == 0>
                                                                <span class="badge badge-success-lighten">提示</span>
                                                                <#elseif vul.level == 1>
                                                                    <span class="badge badge-info-lighten">低危</span>
                                                                    <#elseif vul.level == 2>
                                                                        <span class="badge badge-warning-lighten">中危</span>
                                                                        <#else>
                                                                            <span class="badge badge-danger-lighten">高危</span>
                                                            </#if>
                                                            </#if>

                                                        </td>
                                                        <td>
                                                            ${TemplateUtils.getVulnNameByType(vul.type)}
                                                        </td>
                                                        <td>
                                                            <#if (vul.payload)??>

                                                                <textarea class="form-control" rows="2" >${vul.payload}</textarea>
                                                            </#if>
                                                        </td>

                                                        <td>
                                                            <a href="javascript:void(0);" onclick="getVulResult('${vul.id}')" data-toggle="modal" data-target="#vul-result-modal"  class="action-icon"> <i class="mdi mdi-eye"></i></a>

                                                        </td>
                                                    </tr>

                                                </#list>


                                                </tbody>
                                            </table></div>
                                    </div> <!-- end card-body-->

                                    <div class="modal fade" id="vul-result-modal" tabindex="-1">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header border-bottom-0 d-block">
                                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                                    <h4 class="modal-title">漏洞详情</h4>
                                                </div>
                                                <div class="modal-body p-4">
                                                    <div class="form-group">
                                                        <textarea id="vulResult" class="form-control" rows="20"></textarea>
                                                    </div>

                                                </div> <!-- end modal-body-->
                                            </div> <!-- end modal-content-->
                                        </div> <!-- end modal dialog-->
                                    </div>
                                    <!-- end modal-->

                                </div> <!-- end card-->
                            </div> <!-- end col -->
                        </div>

                    </div>
                    <!-- container -->

                </div>
                <!-- content -->

                <!-- Footer Start -->
                <footer class="footer">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-md-6">
                                2018 - 2019 © TrackRay Author:浅蓝
                            </div>
                           
                        </div>
                    </div>
                </footer>
                <!-- end Footer -->

            </div>

            <!-- ============================================================== -->
            <!-- End Page content -->
            <!-- ============================================================== -->


        </div>
        <!-- END wrapper -->

        <#include "footer.html"/>


</body>
</html>